Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Playing Capture to Conquer on Linux

Here's a small little game from the past, that I used to play. It's a pleasant diversion I rediscovered when going through old files: Capture to Conquer. This is very, very different from Command & Conquer.

Some web links about the game:

The point of the game is to take over the small board. It feels like stratego combined with checkers: every spot is occupied, and you can take ownership of it by attacking with a superior unit. The single-player campaign has a series of missions with different starting configurations, but the end goal is usually controlling the entire board, or sometimes capturing an enemy flag.

You're subject to the whims of the RNG, and I swear at least one mission depends on checking the box in the settings for, "attacker only loses one rank when capturing."

To run this game in Wine on Linux, you need a very short list of steps. If necessary, to separate it from other prefixes, make a windows 98 one. I didn't try any other target versions, but the game ran back in the '98 days, so why waste time with any other version?

export WINEPREFIX=~/.wine-win98 WINEARCH=win32
wineboot # to establish the new prefix
winetricks win98
winetricks vb6run comdlg32ocx native_oleaut32

That's it. Of course cd to the directory containing the executable before running it, like most (Windows) programs.

cd ~/".wine-win98/drive_c/Capture to Conquer"
export WINEPREFIX=~/.wine-win98 WINEARCH=win32
wine CTC.exe

Here are some images.

Menu

Campaign list at 100% completion

Game board

See, it is possible to win the campaign!

updating set-my-repos.sh for deb822 format

I've previously described set-my-repos.sh in a multitude of posts:

I've updated my process to work with deb822 format, which ironically is not fully documented there, and you have to read manpages.debian.org to understand all the fields.

A major improvement to this whole process is that I no longer need a custom /etc/apt/apt.conf.d/52apt-file-stackrpms.conf file at all. Because you can specify Components, or just omit that, apt will then figure out the Contents sections correctly!

The downside is that because I'm not storing the original upstream url for the OBS repositories in, for example, a separate file, and because I resign the repository (so I can include the older versions of dpkgs in the repo), the gpg keys won't match even if I use the upstream url. I should probably bother to set up a "Enabled: no" version of "OBS bgstack15-upstream" repo files, but I haven't bothered to do that yet.

I don't think one-line-style format is going away anytime soon, but I liked the idea of using the newer option, and it had that awesome bonus of not needing the custom apt-file config (which was flaky).

You can see the old version (from my 2024-05-05 post linked earlier) here

files/2024/listings/set-my-repos-2024-09.sh (Source)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/bin/sh
# File: /mnt/public/Support/Platforms/devuan/set-my-repos.sh
# Location:
# Author: bgstack15
# Startdate: 2019-08-10 16:02
# Title: Script that Establishes the repos needed for Devuan
# Purpose: Set up the 3 repos I always need on devuan clients
# History:
#    2020-02-01 customize clients for devuan-archive
#    2020-10-23 add apt-file compatibility
#    2021-01-27 disable devuan-archive
#    2024-01-03-4 14:53 add pref for zenity with gtk3
#    2024-09-12-5 13:52 use deb822 format sources now
# Usage:
#    sudo set-my-repos.sh
# Reference:
#    /mnt/public/Support/Platforms/devuan/devuan.txt
# Improve:
#    need to control the sources.list file itself to have the main, contrib, etc., for ceres.
# Documentation:

test -z "${ALLREPOSGLOB}" && ALLREPOSGLOB="/etc/apt/sources.list /etc/apt/sources.list.d/*"
test -z "${REPOSBASE}" && REPOSBASE="/etc/apt/sources.list.d"
test -z "${PREFSBASE}" && PREFSBASE="/etc/apt/preferences.d"
test -z "${ADDLCONFBASE}" && ADDLCONFBASE="/etc/apt/apt.conf.d"

# confirm key
confirm_key() {
   # call: confirm_key "${PRETTYNAME}" "${SEARCHPHRASE}" "${URL_OF_KEY}"
   ___ck_repo="${1}"
   ___ck_sp="${2}"
   ___ck_url="${3}"
   if apt-key list 2>/dev/null | grep -qe "${___ck_sp}" ;
   then
      :
   else
      # not found so please add it
      echo "Adding key for ${___ck_repo}" 1>&2
      #wget -O- "${___ck_url}" | sudo apt-key add -
      ___ck_keyfile="/etc/apt/trusted.gpg.d/$( echo "${___ck_repo}" | tr '[: ]' '_' ).gpg"
      wget -O- --quiet "${___ck_url}" | gpg --dearmor | sudo tee "${___ck_keyfile}" 1>/dev/null
   fi
}

# confirm repo
confirm_repo() {
   # call: confirm_repo "${PRETTYNAME}" "${SEARCHPHRASE}" "${SEARCHGLOB}" "${FULLSTRING}" "${PREFERRED_FILENAME}" "${OVERWRITE}"
   ___cr_repo="${1}"
   ___cr_sp="${2}"
   ___cr_sf="${3}"
   ___cr_full="${4}"
   ___cr_pref="${5}"
   ___cr_overwrite="${6}"
   if ! grep -E -qe "${___cr_sp}" ${___cr_sf} ;
   then
      # not found so please add it to preferred file
      echo "Adding repo ${___cr_repo}" 1>&2
      if test "${___cr_overwrite}" = "true" ;
      then
         # overwrite, instead of append
         echo "${___cr_full}" > "${REPOSBASE}/${___cr_pref:-99_misc.list}"
      else
         echo "${___cr_full}" >> "${REPOSBASE}/${___cr_pref:-99_misc.list}"
      fi
   fi
}

confirm_sources() {
   # call: confirm_sources "${PRETTYNAME}" "${URIS}" "${SUITES}" "${SIGNEDBY}" "${FILENAME}" "${OVERWRITE}" "${REMOVE_LISTFILE}"
   __cs_prettyname="${1}"
   __cs_uris="${2}"
   __cs_suites="${3}" # probably will be "/" for my kind of repos
   __cs_signedby="${4}"
   __cs_filename="${5}"
   __cs_overwrite="${6}"
   __cs_remove_listfile="${7}"
   # determine if cs_filename is short, if so, prepend /etc/apt/sources.list.d
   if test "${__cs_filename}" = "$( basename "${__cs_filename}" )" ;
   then
      __cs_filename="/etc/apt/sources.list.d/${__cs_filename}"
   fi
   __cs_listfile="${__cs_filename%%.sources}.list"
   if test "${__cs_listfile}" = "$( basename "${__cs_listfile}" )" ;
   then
      __cs_listfile="/etc/apt/sources.list.d/${__cs_listfile}"
   fi
   # determine of cs_signedby gpg key is short, if so, prepend /etc/apt/trusted.gpg.d
   if test -n "${__cs_signedby}" && test "${__cs_signedby}" = "$( basename "${__cs_signedby}" )" ;
   then
      __cs_signedby="/etc/apt/trusted.gpg.d/${__cs_signedby}"
   fi
   if test ! -r "${__cs_filename}" || test "{__cs_overwrite}" = "true";
   then
      {
         echo "Enabled: yes"
         echo "Types: deb"
         echo "URIs: ${__cs_uris}"
         echo "Suites: ${__cs_suites}"
         test -n "${__cs_prettyname}" && echo "X-Repolib-Name: ${__cs_prettyname}" || :
         test -n "${__cs_signedby}" && echo "Signed-By: ${__cs_signedby}"
      } > "${__cs_filename}"
   fi
   test "${__cs_remove_listfile}" = "true" && test -f "${__cs_listfile}" && echo "${__cs_listfile}" | grep -qE "\/etc\/apt\/sources\.list\.d\/.+\.list$" 1>/dev/null 2>&1 && rm -f "${__cs_listfile}"
}

confirm_preferences() {
   # call: confirm_preferences "${PRETTYNAME}" "${FILENAME}" "{PACKAGE}" "${PIN_EXPRESSION}" "{PRIORITY}"
   ___cp_prettyname="${1}"
   ___cp_pref="${2}"
   ___cp_package="${3}"
   ___cp_pin_expression="${4}"
   ___cp_priority="${5}"
   ___cp_version="${6}"

   ___cp_tempfile="$( mktemp )"
   {
      echo "Package: ${___cp_package}"
      test -n "${___cp_version}" && echo "Version: ${___cp_version}"
      echo "Pin: ${___cp_pin_expression}"
      echo "Pin-Priority: ${___cp_priority}"
   } > "${___cp_tempfile}"

   diff "${PREFSBASE}/${___cp_pref}" "${___cp_tempfile}" 1>/dev/null 2>&1 || {
      echo "Setting preferences for ${___cp_prettyname}"
      touch "${PREFSBASE}/${___cp_pref}" ; chmod 0644 "${PREFSBASE}/${___cp_pref}"
      cat "${___cp_tempfile}" > "${PREFSBASE}/${___cp_pref}"
   }

   rm -f "${___cp_tempfile:-NOTHINGTODEL}" 1>/dev/null 2>&1
}

# REPO 1: local internaldeb
confirm_key "internaldeb" "bgstack15.*www\.no-ip\.biz" "http://server3/internal/repo/deb/internaldeb.gpg"
confirm_sources "Internal Dpkg repo" "http://server3/internal/repo/deb" "/" "internaldeb.gpg" "internaldeb.sources" "true" "true"

# REPO 2: local devuan-deb
confirm_key "devuan-deb" "bgstack15.*www\.no-ip\.biz" "http://server3/internal/repo/deb/internaldeb.gpg"
confirm_sources "Internal Devuan dpkgs" "http://server3/internal/repo/devuan-deb" "/" "internaldeb.gpg" "devuan-deb.sources" "true" "true"

# REPO 3: local obs
# Thankfully I re-sign this with my own key.
#confirm_key "OBS bgstack15" "bgstack15@build\.opensuse\.org" "https://download.opensuse.org/repositories/home:bgstack15/Debian_Unstable/Release.key"
confirm_key "OBS bgstack15" "bgstack15.*www\.no-ip\.biz" "http://server3/mirror/obs/Release.key"
confirm_sources "OBS bgstack15" "http://server3/mirror/obs" "/" "OBS_bgstack15.gpg" "home:bgstack15.sources" "true" "true"

# REPO 4: local devuan-archive
# deprecated circa 2021-05
# enabled again 2023-08-22 for discord/gconf
confirm_key "devuan-archive" "bgstack15.*www\.no-ip\.biz" "http://server3/internal/repo/deb/internaldeb.gpg"
confirm_sources "Internal Devuan archive" "http://server3.ipa.internal.com/internal/repo/devuan-archive" "/" "internaldeb.gpg" "devuan-archive.sources" "true" "true"
confirm_preferences "devuan-archive" "puddletag" "*" "origin server3.ipa.internal.com" "700"

# REPO 5: local obs-aftermozilla key for non-local aftermozilla repo
# just the key
#confirm_key "OBS bgstack15 aftermozilla" "bgstack15@build\.opensuse\.org" "https://download.opensuse.org/repositories/home:bgstack15:aftermozilla/Debian_Unstable/Release.key"

# REPO 5: local obs-AfterMozilla
#confirm_key "OBS bgstack15" "bgstack15@build\.opensuse\.org" "http://server3/mirror/obs/Release.key"
confirm_key "OBS bgstack15" "bgstack15.*www\.no-ip\.biz" "http://server3/mirror/obs/Release.key"
confirm_sources "OBS AfterMozilla" "http://server3/mirror/obs-AfterMozilla" "/" "OBS_bgstack15.gpg" "home:bgstack15:AfterMozilla.sources" "true" "true"

# REPO 6: local obs-gtk3-classic
confirm_key "OBS bgstack15" "bgstack15.*www\.no-ip\.biz" "http://server3/mirror/obs/Release.key"
confirm_sources "OBS gtk3-classic" "http://server3/mirror/obs-gtk3-classic" "/" "OBS_bgstack15.gpg" "home:bgstack15:gtk3-classic.sources" "true" "true"

# ADDITIONAL APT PREFS
# important for the [target] stuff to work on repos so apt-file can work
#cp -p "$( dirname "$( readlink -f "${0}" )")/input/52apt-file-stackrpms.conf" "${ADDLCONFBASE}/"
rm -f "${ADDLCONFBASE}/52apt-file-stackrpms.conf" 2>/dev/null || :
# 2023-10-27-6 08:47 use apt-preferences to hold this exact app version because newer versions remove the system tray icon.
confirm_preferences "all" "krb5-auth-dialog" "krb5-auth-dialog" "release" "1000" "3.26.1-4"
# zenity with gtk3 is stored in devuan-deb
confirm_preferences "all" "zenity" "zenity" "release" "600" "3.44.2-1"
confirm_preferences "all" "zenity-common" "zenity-common" "release" "600" "3.44.2-1"

Basically, a new style repo looks like:

Enabled: yes
Types: deb
URIs: http://server3/internal/repo/deb
Suites: /
X-Repolib-Name: Internal Dpkg repo
Signed-By: /etc/apt/trusted.gpg.d/internaldeb.gpg

Which is easier for some parsing compared to:

deb [target-=Contents-deb target+=Contents-stackrpms] http://server3/internal/repo/deb/ /

Which is believable.

OS and distro over time

I use primarily Devuan GNU+Linux for desktop. I even have a server or two running that. For most of my servers, I run various community Enterprise Linux variants: CentOS7, AlmaLinux 8, and Rocky Linux 9. I keep a Fedora vm around but there's really no good use for that anymore.

I still have a Windows 7 vm, and a Windows XP laptop (with genuine floppy disk drive).

My desktop GNU/Linux experience started in November 2015, and my main servers on my home network switched in the summer of 2017.

Run as admin Powershell window, run as other user

So if you've already entered credentials to run a Powershell window as a different user, but you still need to run an elevated, i.e., run-as-administrator, prompt, you can type this command in.

Start-Process powershell -Verb RunAs

Alternative

But if you've not done anything yet, and want to open a cmd.exe prompt (notably, not Powershell!) to then kick off such a process:

%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -WindowStyle Hidden -Command Start-Process -Verb RunAsUser $PSHOME\powershell.exe '-NoProfile -Command Start-Process -Verb RunAs \\\"$PSHOME\powershell.exe\\\"'; Start-Sleep 120

Reference:

  1. https://superuser.com/questions/661979/run-as-different-user-and-elevate

asn1parse and underscores

If you are building a CSR that includes the oid for a Microsoft Certificate Services template name, and that name includes an underscore, you might get an error when building a csr.

Error checking request extension section req_ext
00CCADFE01000000:error:0680007C:asn1 encoding routines:ASN1_mbstring_ncopy:illegal characters:crypto/asn1/a_mbstr.c:113:
00CCADFE01000000:error:0688000D:asn1 encoding routines:asn1_str2type:ASN1 lib:crypto/asn1/asn1_gen.c:681:string=ABC_NAME_TESTING
00CCADFE01000000:error:11000074:X509 V3 routines:v3_generic_extension:extension value error:crypto/x509/v3_conf.c:260:value=PRINTABLESTRING:ABC_NAME_TESTING

So what you can do is switch your openssl.cnf to use a different data type: UTF8STRING.

oid_section = new_oids
[ new_oids ]
certificateTemplateName = 1.3.6.1.4.1.311.20.2
[ req_ext ]
certificateTemplateName = ASN1:UTF8STRING:ABC_NAME_TESTING

Resize x11vnc session

Here's a cool trick I devised. This idea is original to me. I remember using spice guest tools in spice guests in libvirt/qemu/kvm/virt-manager to automatically (or at least make available) change screen resolutions.

Remmina as a vnc viewer of course can be resized, and I have a script that I run on the client side, to ssh to the target x11vnc server.

The idea is that on the client x11 instance, you run the following command which finds the window with that hostname as the title (hardcoded to only Remmina windows), and then passwordlessly sshes to that host and uses the XAUTHORITY and DISPLAY info to add a xrandr resolution to this desired window size and then uses that resolution.

Read more…

Set wine theme from cli

I spent time configuring a new wine prefix with the boring, office-gray theme. I do that every time, because the default (that started within the past year or so) is to have the theme "Light" which looks white and puffy and annoying.

Before:

Run the following registry file with this command.

wine regedit use-theme-none.reg

files/2024/listings/use-theme-none.reg (Source)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Windows Registry Editor Version 5.00
# File: use-theme-none.reg
# Location: /mnt/public/Support/Programs/wine/
# Author: bgstack15
# SPDX-License-Identifier: GPL-3.0-only
# Startdate: 2024-08-14-4 21:20
# Title: Theme None registry keys
# Purpose: Oneliner to set theme none in a new wine prefix
# History:
# Usage:
#    wine regedit use-theme-none.reg
# References:
#    https://gist.githubusercontent.com/Zeinok/ceaf6ff204792dde0ae31e0199d89398/raw/a5f0d3efb309d6d0728e1e54579e5c1081cf0d22/wine-breeze-dark.reg
#    https://forums.linuxmint.com/viewtopic.php?t=394382
#    https://superuser.com/questions/380156/delete-registry-key-or-value-via-a-cmd-script/1041579#1041579
# Alternatives:
#    winecfg, tab Desktop Integration -> Theme (no theme)
# Improve:
# Documentation:
#    Exported from a blank wine prefix and customized. Had to s/\\\\/\\/g, and prepend HKCU to all places. Had to switch header to "Windows Registry Editor Version 5.00" and remove a ;; comment about a key prefix.
#arch=win64

[HKEY_CURRENT_USER\Control Panel\Colors] 1723684031
#time=1daeeaf754f3e32
"ActiveBorder"="212 208 200"
"ActiveTitle"="10 36 106"
"Background"="58 110 165"
"ButtonAlternateFace"="181 181 181"
"ButtonDkShadow"="64 64 64"
"ButtonFace"="212 208 200"
"ButtonLight"="212 208 200"
"ButtonShadow"="128 128 128"
"GradientActiveTitle"="166 202 240"
"GradientInactiveTitle"="192 192 192"
"GrayText"="128 128 128"
"Hilight"="10 36 106"
"HotTrackingColor"="0 0 200"
"InactiveBorder"="212 208 200"
"InactiveTitleText"="212 208 200"
"InfoWindow"="255 255 225"
"Menu"="212 208 200"
"MenuBar"="212 208 200"
"MenuHilight"="10 36 106"
"Scrollbar"="212 208 200"
"TitleText"="255 255 255"
"WindowFrame"="0 0 0"

[HKEY_CURRENT_USER\Control Panel\Desktop] 1723684031
#time=1daeeaf7552a34c
"UserPreferencesMask"=hex:30,00,00,80,12,00,00,00

[HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics] 1723684031
#time=1daeeaf7553711e
"CaptionFont"=hex:f3,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\
  00,00,00,01,00,00,00,00,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"CaptionHeight"="-270"
"CaptionWidth"="-270"
"IconFont"=hex:f5,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,\
  00,00,01,00,00,00,22,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"MenuFont"=hex:f5,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,00,\
  00,00,01,00,00,00,00,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"MenuHeight"="-270"
"MenuWidth"="-270"
"MessageFont"=hex:f5,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\
  00,00,00,01,00,00,00,00,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"ScrollHeight"="-240"
"ScrollWidth"="-240"
"SmCaptionFont"=hex:f5,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,\
  00,00,00,00,01,00,00,00,22,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
"SmCaptionHeight"="-225"
"SmCaptionWidth"="-225"
"StatusFont"=hex:f5,ff,ff,ff,00,00,00,00,00,00,00,00,00,00,00,00,90,01,00,00,\
  00,00,00,01,00,00,00,00,54,00,61,00,68,00,6f,00,6d,00,61,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,\
  00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ThemeManager] 1723684031
#time=1daeeaf754f0868
"ColorName"=-
"DllName"=-
"LoadedBefore"=-
"SizeName"=-
"ThemeActive"="0"

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize] 1723684031
#time=1daeeaf754f020a
"AppsUseLightTheme"=dword:00000001
"SystemUsesLightTheme"=dword:00000001

References

  1. https://gist.githubusercontent.com/Zeinok/ceaf6ff204792dde0ae31e0199d89398/raw/a5f0d3efb309d6d0728e1e54579e5c1081cf0d22/wine-breeze-dark.reg
  2. Wine dark theme - Linux Mint Forums
  3. command line - Delete registry key or value via a CMD script? - Super User

Touch file with XFE Script

I use an empty file with the modification timestamp to indicate the last time I manually synced my SyncThing-ed directory of my mobile phone pictures to my backup location.

I set up an alias to touch in my ~/.config/xfe/scripts directory.

$ ls -l ~/.config/xfe/scripts
total 3
lrwxrwxrwx 1 bgstack15 bgstack15  14 Aug 13 14:42 touch -> /usr/bin/touch

So now I can just right-click the file and update the timestamp, now that I have re-synced. Because I keep some images on my mobile phone, I won't need to bother with any older than this synced-here file.

Read signature of .ps1 file with CLI on Linux

If you wish to read the PKCS7-encoded signature on a powershell script, and you don't have osslsigncode verify available to you (from https://github.com/mtrojnar/osslsigncode), you can use this script.

files/2024/listings/read-signature.sh (Source)

#!/usr/bin/env sh
# File: read-signature.sh
# Location: blog
# Author: bgstack15
# SPDX-License-Identifier: GPL-3.0-only
# Startdate: 2024-08-08-5 14:35
# Title: Read Signature
# Purpose: Read codesign signature on a powershell script on Unix-like cli
# History:
# Usage:
# Reference:
# Improve:
# Dependencies:
#    openssl, gsed, gawk, posix shell
# Documentation:
#    Skipping SAN; tends to not be used on codesigning certs?
command -v sed 1>/dev/null 2>&1 && SED=sed
command -v gsed 1>/dev/null 2>&1 && SED=gsed
command -v awk 1>/dev/null 2>&1 && AWK=awk
command -v gawk 1>/dev/null 2>&1 && AWK=gawk
read_sig() {
   _in="${INFILE:-${1}}"
   _in="${_in:-/dev/stdin}"
   test "${_in}" = "-" && _in="/dev/stdin"
   _contents="$(
      printf '%s\n' '-----BEGIN PKCS7-----'
      <"${_in}" "${SED}" -r -n '/^# SIG # Begin/,/^# SIG # End/{s/^\# //;p;}' | tr -d '\r' | grep -v -e 'signature block'
      printf '%s\n' '-----END PKCS7-----'
   )"
   # would need to parse SANs here if any.
   echo "${_contents}" | openssl pkcs7 -in /dev/stdin -print_certs | openssl x509 -in /dev/stdin -noout -subject -issuer -serial -email -dates
   # Print date
   echo "${_contents}" | openssl pkcs7 -in /dev/stdin -print -noout | "${AWK}" '/signingTime/{getline;getline;gsub(":","",$NF);print $NF}' | "${SED}" -r -e 's/^(.{2})(.{2})(.{2})(.{2})(.{2})(.{2})/timestamp=20\1-\2-\3T\4:\5:\6/;'
}

Notice how I make sure we find GNU sed and awk, because the old BSD ones use a different syntax that are not worth learning. Just use real sed and awk.